home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / comm / tcp / Amster.lha / Amster_Install / Source / resultview.c < prev    next >
C/C++ Source or Header  |  2000-07-31  |  16KB  |  569 lines

  1. /*
  2. ** Amster - Result view
  3. ** by Jacob Laursen <laursen@myself.com>
  4. */
  5.  
  6. #include "include/config.h"
  7.  
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <string.h>
  11.  
  12. #include <proto/dos.h>
  13.  
  14. #include "include/mui.h"
  15. #include <MUI/Lamp_mcc.h>
  16. #include <MUI/NListview_mcc.h>
  17.  
  18. #include "include/gui.h"
  19. #include "include/resultview.h"
  20. #include "include/protos.h"
  21. #include "include/napster.h"
  22. #include "include/download.h"
  23. #include "include/panel.h"
  24. #include "include/prefs.h"
  25. #include "include/rexx.h"
  26. #include "include/search.h"
  27. #include "include/hotlist.h"
  28. #include "amster_Cat.h"
  29. #include "include/protos.h"
  30.  
  31. /* Private prototypes */
  32.  
  33. ULONG resultview_new(struct IClass *cl, Object *obj, struct opSet *msg);
  34. MUIF resultlistdisp(REG(a2) char **array, REG(a1) song s);
  35. MUIF resultlistcomp(REG(a0) struct Hook *hook, REG(a2) Object *obj, REG(a1) struct NList_CompareMessage *ncm);
  36. void resultview_clear(struct resultdata *data, int t);
  37. void resultview_download(struct resultdata *data, int t, int num);
  38. void resultview_nick(struct resultdata *data, char *nick);
  39. void resultview_stat(struct resultdata *data, int t);
  40. void resultview_found(struct resultdata *data, song s);
  41. void resultview_reset(struct resultdata *data);
  42. void resultview_fillstem(struct resultdata *data, char *stem);
  43.  
  44. /* Global variables */
  45.  
  46. char *gColFormat;
  47.  
  48.  
  49. MUIF resultview_dispatch(REG(a0) struct IClass *cl,REG(a2) Object *obj,REG(a1) Msg msg)
  50. {
  51.     struct resultdata *data;
  52.  
  53.     switch (msg->MethodID) {
  54.         case OM_NEW:
  55.             return(resultview_new(cl, obj, (APTR)msg));
  56.         case RESULTVIEW_CLEAR:
  57.             data = INST_DATA(cl, obj);
  58.             resultview_clear(data, (int)(((muimsg)msg)->arg1));
  59.             return NULL;
  60.         case RESULTVIEW_DOWNLOAD:
  61.             data = INST_DATA(cl, obj);
  62.             resultview_download(data, (int)(((muimsg)msg)->arg1), (int)(((muimsg)msg)->arg2));
  63.             return NULL;
  64.         case RESULTVIEW_FOUND:
  65.             data = INST_DATA(cl, obj);
  66.             resultview_found(data, (song)(((muimsg)msg)->arg1));
  67.             return NULL;
  68.         case RESULTVIEW_TOGGLE_BOTH:
  69.             {
  70.             u_long tmp;
  71.             data = INST_DATA(cl, obj);
  72.             GetAttr(MUIA_Selected, data->fptog, &tmp);
  73.             prf->fullpath = tmp;
  74.             DoMethod(gui->searchpanel, SEARCH_TOGGLE);
  75.             DoMethod(gui->WI_Hotlist, HOTLIST_TOGGLE);
  76.             return NULL;
  77.             }
  78.         case RESULTVIEW_TOGGLE_ONE:
  79.             data = INST_DATA(cl, obj);
  80.             set(data->fptog, MUIA_Selected, prf->fullpath);
  81.             DoMethod(data->list, MUIM_NList_Redraw, MUIV_NList_Redraw_All);
  82.             return NULL;
  83.         case RESULTVIEW_STAT:
  84.             data = INST_DATA(cl, obj);
  85.             set(data->result, MUIA_Text_Contents, (char *)(((muimsg)msg)->arg1));
  86.             return NULL;
  87.         case RESULTVIEW_STAT2:
  88.             data = INST_DATA(cl, obj);
  89.             resultview_stat(data, (int)(((muimsg)msg)->arg1));
  90.             return NULL;
  91.         case RESULTVIEW_INSERT:
  92.             data = INST_DATA(cl, obj);
  93.             DoMethod(data->list, MUIM_NList_InsertSingle, (song)(((muimsg)msg)->arg1), MUIV_NList_Insert_Sorted);
  94.             return NULL;
  95.         case RESULTVIEW_NICK:
  96.             {
  97.             data = INST_DATA(cl, obj);
  98.             resultview_nick(data, (char *)(((muimsg)msg)->arg1));
  99.             return NULL;
  100.             }
  101.         case RESULTVIEW_RESETCOUNT:
  102.             data = INST_DATA(cl, obj);
  103.             data->resultview_count = 0;
  104.             return NULL;
  105.         case RESULTVIEW_GETSTATE:
  106.             data = INST_DATA(cl, obj);
  107.             search_state = data->resultview_state;
  108.             return NULL;
  109.         case RESULTVIEW_FILLSTEM:
  110.             data = INST_DATA(cl, obj);
  111.             resultview_fillstem(data, (char *)(((muimsg)msg)->arg1));
  112.             return NULL;
  113.     }
  114.     return(DoSuperMethodA(cl, obj, msg));
  115. }
  116.  
  117.  
  118. ULONG resultview_new(struct IClass *cl, Object *obj, struct opSet *msg)
  119. {
  120.     static struct Hook resultlistdispHook = { {0,0}, &resultlistdisp, NULL, NULL };
  121.     static struct Hook resultlistcompHook = { {0,0}, &resultlistcomp, NULL, NULL };
  122.     struct resultdata *data;
  123.  
  124.     Object *result, *list;
  125.     Object *BT_Clear, *BT_ClearAll, *BT_Download, *fptog;
  126. /*    Object *BT_Resume;*/
  127.  
  128.     if (obj = (Object *)DoSuperNew(cl, obj,
  129.         Child, VGroup,
  130.             Child, HGroup,
  131.                 Child, Label(MSG_RESULT),
  132.                 Child, result = TextObject, End,
  133.             End,
  134.             Child, NListviewObject,
  135.                 MUIA_NListview_NList, list = NListObject,
  136.                     InputListFrame,
  137.                     MUIA_NList_Title, TRUE,
  138.                     MUIA_NList_Format, gColFormat,
  139.                     MUIA_NList_MultiSelect, MUIV_NList_MultiSelect_Default,
  140.                     MUIA_NList_DisplayHook, &resultlistdispHook,
  141.                     MUIA_NList_CompareHook2, &resultlistcompHook,
  142.                     MUIA_CycleChain, 1,
  143.                 End,
  144.             End,
  145.             Child, HGroup,
  146.                 Child, BT_Clear    = SimpleButton(MSG_CLEAR_GAD),
  147.                 Child, BT_ClearAll = SimpleButton(MSG_CLEARALL_GAD),
  148. /*                Child, BT_Resume   = SimpleButton(MSG_RESUME_GAD),*/
  149.                 Child, BT_Download = SimpleButton(MSG_DOWNLOAD_GAD),
  150.                 Child, TextObject,
  151.                     MUIA_HorizWeight, 25,
  152.                     MUIA_Text_PreParse, "\33r",
  153.                     MUIA_Text_Contents, MSG_SEARCH_FULLPATH,
  154.                 End,
  155.                 Child, fptog = ImageObject,
  156.                     ButtonFrame,
  157.                     MUIA_HorizWeight, 10,
  158.                     MUIA_Background, MUII_ButtonBack,
  159.                     MUIA_InputMode, MUIV_InputMode_Toggle,
  160.                     MUIA_ShowSelState, FALSE,
  161.                     MUIA_Image_Spec, "6:15",
  162.                     MUIA_Selected, prf->fullpath,
  163.                 End,
  164.             End,
  165.         End,
  166.         TAG_MORE, msg->ops_AttrList))
  167.     {
  168.         data = INST_DATA(cl,obj);
  169.         data->result = result;
  170.         data->list = list;
  171. /*        data->BT_Resume = BT_Resume;*/
  172.         data->BT_Clear = BT_Clear;
  173.         data->BT_ClearAll = BT_ClearAll;
  174.         data->BT_Download = BT_Download;
  175.         data->fptog = fptog;
  176.  
  177.         lamp_useinlist(list);
  178.  
  179.         DoMethod(BT_Clear,    MUIM_Notify, MUIA_Pressed, FALSE, obj, 2, RESULTVIEW_CLEAR, CLEAR_MARKED);
  180.         DoMethod(BT_ClearAll, MUIM_Notify, MUIA_Pressed, FALSE, obj, 2, RESULTVIEW_CLEAR, CLEAR_ALL   );
  181.         DoMethod(BT_Download, MUIM_Notify, MUIA_Pressed, FALSE, obj, 3, RESULTVIEW_DOWNLOAD, 0, 0);
  182. /*        DoMethod(BT_Resume, MUIM_Notify, MUIA_Pressed, FALSE, obj, 3, RESULTVIEW_DOWNLOAD, 2, 0);*/
  183.         DoMethod(list, MUIM_Notify, MUIA_NList_DoubleClick, MUIV_EveryTime, obj, 3, RESULTVIEW_DOWNLOAD, 1, 0);
  184.  
  185.         DoMethod(fptog, MUIM_Notify, MUIA_Selected, MUIV_EveryTime, obj, 1, RESULTVIEW_TOGGLE_BOTH);
  186.  
  187.         DoMethod(list, MUIM_Notify, MUIA_NList_TitleClick,  MUIV_EveryTime, list, 4, MUIM_NList_Sort3, MUIV_TriggerValue, MUIV_NList_SortTypeAdd_2Values, MUIV_NList_Sort3_SortType_Both);
  188.         DoMethod(list, MUIM_Notify, MUIA_NList_TitleClick2, MUIV_EveryTime, list, 4, MUIM_NList_Sort3, MUIV_TriggerValue, MUIV_NList_SortTypeAdd_2Values, MUIV_NList_Sort3_SortType_2);
  189.         DoMethod(list, MUIM_Notify, MUIA_NList_SortType,    MUIV_EveryTime, list, 3, MUIM_Set, MUIA_NList_TitleMark,  MUIV_TriggerValue);
  190.         DoMethod(list, MUIM_Notify, MUIA_NList_SortType2,   MUIV_EveryTime, list, 3, MUIM_Set, MUIA_NList_TitleMark2, MUIV_TriggerValue);
  191.  
  192.         return((ULONG)obj);
  193.     }
  194.     return NULL;
  195. }
  196.  
  197.  
  198. MUIF resultlistdisp(REG(a2) char **array, REG(a1) song s)
  199. {
  200.     static char buf[50], buf2[50], buf3[50], time[40];
  201.  
  202.     if (s) {
  203.         if (s->link == 0)
  204.             *array++ = lamp_getforlist(0);
  205.         else if(s->link < 5)
  206.             *array++ = lamp_getforlist(1);
  207.         else if(s->link < 8)
  208.             *array++ = lamp_getforlist(2);
  209.         else
  210.             *array++ = lamp_getforlist(3);
  211.  
  212.         if (prf->fullpath)
  213.             *array++ = s->title;
  214.         else
  215.             *array++ = nap_strippath(s->title);
  216.  
  217.         sprintf(buf,"\33c%d",s->bit);
  218.         *array++ = buf;
  219.         sprintf(buf2,"\33c%d",s->freq);
  220.         *array++ = buf2;
  221.         sprintf(buf3,"\33r%ld",s->size);
  222.         *array++ = buf3;
  223.  
  224.         if (s->time>0) {
  225.             int secs = s->size/(s->bit*125);
  226.             if(abs(s->time - secs)*100/s->time > 3)
  227.                 sprintf(time,"\33r\33i%ld:%02ld",s->time/60,s->time%60);
  228.             else
  229.                 sprintf(time,"\33r%ld:%02ld",s->time/60,s->time%60);
  230.         }
  231.         else {
  232.             sprintf(time,"\33r0:00");
  233.         }
  234.         *array++ = time;
  235.  
  236.         *array++ = s->user;
  237.         *array = nap_linktype[s->link];
  238.     }
  239.     else {
  240.         *array++ = "\33c@";
  241.         *array++ = (char *)MSG_LH_SONG;
  242.         *array++ = (char *)MSG_LH_KBPS;
  243.         *array++ = (char *)MSG_LH_HZ;
  244.         *array++ = (char *)MSG_LH_SIZE;
  245.         *array++ = (char *)MSG_LH_TIME;
  246.         *array++ = (char *)MSG_LH_USER;
  247.         *array = (char *)MSG_LH_LINK;
  248.     }
  249.     return(0);
  250. }
  251.  
  252.  
  253. void resultview_clear(struct resultdata *data, int t)
  254. {
  255.     u_long item;
  256.  
  257.     switch(t) {
  258.         case CLEAR_MARKED:
  259.         {
  260.             u_long listid = MUIV_NList_NextSelected_Start;
  261.  
  262.             for (;;) {
  263.                 DoMethod(data->list,MUIM_NList_NextSelected,&listid);
  264.                 if (listid==MUIV_NList_NextSelected_End) break;
  265.                 DoMethod(data->list,MUIM_NList_GetEntry,listid,&item);
  266.                 if (item) {
  267.                     DoMethod(data->list,MUIM_NList_Remove,MUIV_NList_Remove_Selected);
  268.                     nap_songfree((song)item);
  269.                 }
  270.             }
  271.             break;
  272.         }
  273.  
  274.         case CLEAR_ALL:
  275.             set(data->list,MUIA_NList_Quiet, MUIV_NList_Quiet_Visual);
  276.             while (1) {
  277.                 DoMethod(data->list, MUIM_NList_GetEntry, 0, &item);
  278.                 if(!item) break;
  279.                 DoMethod(data->list, MUIM_NList_Remove, MUIV_NList_Remove_First);
  280.                 nap_songfree((song)item);
  281.             }
  282.             set(data->list,MUIA_NList_Quiet, MUIV_NList_Quiet_None);
  283.             resultview_stat(data, 0);
  284.             break;
  285.     }
  286. }
  287.  
  288.  
  289. void resultview_download(struct resultdata *data, int t, int num)
  290. {
  291.     int f=0;
  292.     u_long item, listid;
  293.  
  294.     if (gui_onlinestate < ONLINE) {
  295.         gRC = 10;
  296.         return;
  297.     }
  298.  
  299.     switch (t) {
  300.         case 0:
  301.             listid = MUIV_NList_NextSelected_Start;
  302.             for (;;) {
  303.                 DoMethod(data->list, MUIM_NList_NextSelected, &listid);
  304.                 if (listid == MUIV_NList_NextSelected_End) break;
  305.                 DoMethod(data->list, MUIM_NList_GetEntry, listid, &item);
  306.                 if (item) {
  307.                     if (!f) {
  308.                         DoMethod(gui->iconpanel, PANEL_OPENDL);
  309.                         f=1;
  310.                     }
  311.                     dl_addq((song)item);
  312.                 }
  313.             }
  314.             break;
  315.  
  316.         case 1:
  317.             GetAttr(MUIA_NList_DoubleClick, data->list, &listid);
  318.             if (listid == -1 || listid == -2) return;
  319.             DoMethod(data->list, MUIM_NList_GetEntry, listid, &item);
  320.             if (!item) return;
  321.             if (!f) {
  322.                 DoMethod(gui->iconpanel, PANEL_OPENDL);
  323.                 f=1;
  324.             }
  325.             dl_addq((song)item);
  326.             break;
  327.  
  328.         case 2:
  329.             DoMethod(data->list, MUIM_NList_GetEntry, MUIV_NList_GetEntry_Active, &item);
  330.             if (!item) return;
  331.             break;
  332.  
  333.         case 3:
  334.             DoMethod(data->list, MUIM_NList_GetEntry, num, &item);
  335.             if (item) {
  336.                 if (!f) {
  337.                     f=1;
  338.                 }
  339.                 dl_addq((song)item);
  340.             }
  341.             else gRC = 9;
  342.             break;
  343.     }
  344. }
  345.  
  346.  
  347. void resultview_nick(struct resultdata *data, char *nick)
  348. {
  349.     if (gui_onlinestate < ONLINE) return;
  350.  
  351.     data->resultview_count = 0;
  352.     if (prf->clrlist) resultview_clear(data, CLEAR_ALL);
  353.     nap_sendbuf(NAPC_BROWSEUSER, nick);
  354.     resultview_stat(data, 3);
  355. }
  356.  
  357.  
  358. void resultview_stat(struct resultdata *data, int t)
  359. {
  360.     static char buf[80];
  361.     char *txt;
  362.  
  363.     switch(t) {
  364.         case 0:
  365.             txt = "";
  366.             data->resultview_state = 0;
  367.             break;
  368.  
  369.         case 1:
  370.             data->resultview_state = 1;
  371.             txt = (char *)MSG_STATUS1_SEARCHING;
  372.             break;
  373.  
  374.         case 2:
  375.             if (data->resultview_count == 0)
  376.                 txt = (char*)MSG_STATUS1_NOFILES;
  377.             else if (data->resultview_count == 1)
  378.                 txt = (char*)MSG_STATUS1_ONEFOUND;
  379.             else {
  380.                 sprintf(buf, MSG_STATUS1_FOUND, data->resultview_count);
  381.                 txt = buf;
  382.             }
  383.             data->resultview_state = 2;
  384.             break;
  385.  
  386.         case 3:
  387.             txt = (char *)MSG_STATUS1_REQLIST;
  388.             break;
  389.     }
  390.  
  391.     set(data->result, MUIA_Text_Contents, txt);
  392. }
  393.  
  394.  
  395. void resultview_found(struct resultdata *data, song s)
  396. {
  397.     if (s) {
  398.         DoMethod(data->list, MUIM_NList_InsertSingle, s, MUIV_NList_Insert_Sorted);
  399.         data->resultview_count++;
  400.     }
  401.     else {
  402.         resultview_stat(data, 2);
  403.     }
  404. }
  405.  
  406.  
  407. MUIF resultlistcomp(REG(a0) struct Hook *hook, REG(a2) Object *obj, REG(a1) struct NList_CompareMessage *ncm)
  408. {
  409.     song entry1 = ncm->entry1;
  410.     song entry2 = ncm->entry2;
  411.     LONG col1 = ncm->sort_type & MUIV_NList_TitleMark_ColMask;
  412.     LONG col2 = ncm->sort_type2 & MUIV_NList_TitleMark2_ColMask;
  413.     ULONG result = 0;
  414.  
  415.     if (ncm->sort_type == MUIV_NList_SortType_None) return (0);
  416.  
  417.     if (col1 == 1) {
  418.         if (ncm->sort_type & MUIV_NList_TitleMark_TypeMask) {
  419.             if (prf->fullpath) result = (LONG) stricmp(entry2->title, entry1->title);
  420.             else result = (LONG) stricmp(nap_strippath(entry2->title), nap_strippath(entry1->title));
  421.         }
  422.         else {
  423.             if (prf->fullpath) result = (LONG) stricmp(entry1->title, entry2->title);
  424.             else result = (LONG) stricmp(nap_strippath(entry1->title), nap_strippath(entry2->title));
  425.         }
  426.     }
  427.     else if (col1 == 2) {
  428.         if (ncm->sort_type & MUIV_NList_TitleMark_TypeMask)
  429.             result = entry2->bit - entry1->bit;
  430.         else
  431.             result = entry1->bit - entry2->bit;
  432.     }
  433.     else if (col1 == 3) {
  434.         if (ncm->sort_type & MUIV_NList_TitleMark_TypeMask)
  435.             result = entry2->freq - entry1->freq;
  436.         else
  437.             result = entry1->freq - entry2->freq;
  438.     }
  439.     else if (col1 == 4) {
  440.         if (ncm->sort_type & MUIV_NList_TitleMark_TypeMask)
  441.             result = entry2->size - entry1->size;
  442.         else
  443.             result = entry1->size - entry2->size;
  444.     }
  445.     else if (col1 == 5) {
  446.         if (ncm->sort_type & MUIV_NList_TitleMark_TypeMask)
  447.             result = entry2->time - entry1->time;
  448.         else
  449.             result = entry1->time - entry2->time;
  450.     }
  451.     else if (col1 == 6) {
  452.         if (ncm->sort_type & MUIV_NList_TitleMark_TypeMask)
  453.             result = (LONG) stricmp(entry2->user, entry1->user);
  454.         else
  455.             result = (LONG) stricmp(entry1->user, entry2->user);
  456.     }
  457.     else if (col1 == 7) {
  458.         if (ncm->sort_type & MUIV_NList_TitleMark_TypeMask)
  459.             result = entry2->link - entry1->link;
  460.         else
  461.             result = entry1->link - entry2->link;
  462.     }
  463.  
  464.     if ((result != 0) || (col1 == col2)) return (result);
  465.  
  466.     if (col2 == 1) {
  467.         if (ncm->sort_type & MUIV_NList_TitleMark2_TypeMask) {
  468.             if (prf->fullpath) result = (LONG) stricmp(entry2->title, entry1->title);
  469.             else result = (LONG) stricmp(nap_strippath(entry2->title), nap_strippath(entry1->title));
  470.         }
  471.         else {
  472.             if (prf->fullpath) result = (LONG) stricmp(entry1->title, entry2->title);
  473.             else result = (LONG) stricmp(nap_strippath(entry1->title), nap_strippath(entry2->title));
  474.         }
  475.     }
  476.     else if (col2 == 2) {
  477.         if (ncm->sort_type & MUIV_NList_TitleMark2_TypeMask)
  478.             result = entry2->bit - entry1->bit;
  479.         else
  480.             result = entry1->bit - entry2->bit;
  481.     }
  482.     else if (col2 == 3) {
  483.         if (ncm->sort_type & MUIV_NList_TitleMark2_TypeMask)
  484.             result = entry2->freq - entry1->freq;
  485.         else
  486.             result = entry1->freq - entry2->freq;
  487.     }
  488.     else if (col2 == 4) {
  489.         if (ncm->sort_type & MUIV_NList_TitleMark2_TypeMask)
  490.             result = entry2->size - entry1->size;
  491.         else
  492.             result = entry1->size - entry2->size;
  493.     }
  494.     else if (col2 == 5) {
  495.         if (ncm->sort_type & MUIV_NList_TitleMark2_TypeMask)
  496.             result = entry2->time - entry1->time;
  497.         else
  498.             result = entry1->time - entry2->time;
  499.     }
  500.     else if (col2 == 6) {
  501.         if (ncm->sort_type & MUIV_NList_TitleMark2_TypeMask)
  502.             result = (LONG) stricmp(entry2->user, entry1->user);
  503.         else
  504.             result = (LONG) stricmp(entry1->user, entry2->user);
  505.     }
  506.     else if (col2 == 7) {
  507.         if (ncm->sort_type & MUIV_NList_TitleMark2_TypeMask)
  508.             result = entry2->link - entry1->link;
  509.         else
  510.             result = entry1->link - entry2->link;
  511.     }
  512.  
  513.     return (result);
  514. }
  515.  
  516.  
  517. void resultview_fillstem(struct resultdata *data, char *stem)
  518. {
  519.     int i;
  520.     song item;
  521.     char buf[1024], buf2[32];
  522.     struct Message *m;
  523.     u_long tmp;
  524.  
  525.     GetAttr(MUIA_Application_RexxMsg, gui->app, &tmp);
  526.     m = (struct Message *)tmp;
  527.  
  528.     for (i=0; i<data->resultview_count; i++) {
  529.         DoMethod(data->list, MUIM_NList_GetEntry, i, &item);
  530.         if (item) {
  531.             sprintf(buf, "%s.%d.TITLE", stem, i);
  532.             SetRexxVar(m, buf, item->title, strlen(item->title));
  533.  
  534.             sprintf(buf, "%s.%d.MD5", stem, i);
  535.             SetRexxVar(m, buf, item->md5, strlen(item->md5));
  536.  
  537.             sprintf(buf, "%s.%d.SIZE", stem, i);
  538.             sprintf(buf2, "%ld", item->size);
  539.             SetRexxVar(m, buf, buf2, strlen(buf2));
  540.  
  541.             sprintf(buf, "%s.%d.BITRATE", stem, i);
  542.             sprintf(buf2, "%ld", item->bit);
  543.             SetRexxVar(m, buf, buf2, strlen(buf2));
  544.  
  545.             sprintf(buf, "%s.%d.FREQUENCY", stem, i);
  546.             sprintf(buf2, "%ld", item->freq);
  547.             SetRexxVar(m, buf, buf2, strlen(buf2));
  548.  
  549.             sprintf(buf, "%s.%d.TIME", stem, i);
  550.             sprintf(buf2, "%ld", item->time);
  551.             SetRexxVar(m, buf, buf2, strlen(buf2));
  552.  
  553.             sprintf(buf, "%s.%d.LINK", stem, i);
  554.             sprintf(buf2, "%d", item->link);
  555.             SetRexxVar(m, buf, buf2, strlen(buf2));
  556.  
  557.             sprintf(buf, "%s.%d.USER", stem, i);
  558.             SetRexxVar(m, buf, item->user, strlen(item->user));
  559.         }
  560.         else {
  561.             gRC = 10;
  562.             break;
  563.         }
  564.     }
  565.     sprintf(buf, "%s.COUNT", stem);
  566.     sprintf(buf2, "%d", data->resultview_count);
  567.     SetRexxVar(m, buf, buf2, strlen(buf2));
  568. }
  569.